package com.dongdongshop.front.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.front.service.SearchService;
import com.dongdongshop.seller.pojo.TbItem;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.IOException;
import java.util.List;

@Controller
@RequestMapping("search")
public class SearchController {

    @Reference(check = false,timeout = 500000)
    private SearchService searchService;

    @RequestMapping("toSearch")
    public String toSearch(String str, Model model) throws IOException {
        List<TbItem> list = searchService.getGooodsAndGoodsDescByName(str);
        model.addAttribute("list",list);
        return "admin/search";
    }
}
